package com.bw.module_mine.login.repository

import com.bw.module_mine.login.http.UserApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import javax.inject.Inject

class UserRepository @Inject constructor(private val api: UserApi)  {
    fun login(password:String,username:String) = flow {
        emit(api.login(password,username))
    }.flowOn(Dispatchers.IO)


    fun register(password:String,username:String) = flow {
        emit(api.register(password, username))
    }.flowOn(Dispatchers.IO)

}